<?php

/**
 * Position form base class.
 *
 * @method Position getObject() Returns the current form's model object
 *
 * @package    virtualstore
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 24171 2009-11-19 16:37:50Z Kris.Wallsmith $
 */
abstract class BasePositionForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'id'                          => new sfWidgetFormInputHidden(),
      'employee_id'                 => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Employee'), 'add_empty' => true)),
      'name'                        => new sfWidgetFormInputText(),
      'startDate'                   => new sfWidgetFormDate(),
      'endDate'                     => new sfWidgetFormDate(),
      'salary'                      => new sfWidgetFormInputText(),
      'payment_periodicity_id'      => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('PaymentPeriodicity'), 'add_empty' => false)),
      'payment_calculation_type_id' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('PaymentCalculationType'), 'add_empty' => false)),
      'location_id'                 => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('PositionLocation'), 'add_empty' => true)),
      'shift_id'                    => new sfWidgetFormInputText(),
      'wage_type_id'                => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('WageType'), 'add_empty' => false)),
      'created_at'                  => new sfWidgetFormDateTime(),
      'updated_at'                  => new sfWidgetFormDateTime(),
      'created_by'                  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('created_by_fk'), 'add_empty' => false)),
      'updated_by'                  => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('updated_by_fk'), 'add_empty' => false)),
    ));

    $this->setValidators(array(
      'id'                          => new sfValidatorDoctrineChoice(array('model' => $this->getModelName(), 'column' => 'id', 'required' => false)),
      'employee_id'                 => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Employee'), 'required' => false)),
      'name'                        => new sfValidatorString(array('max_length' => 100)),
      'startDate'                   => new sfValidatorDate(),
      'endDate'                     => new sfValidatorDate(array('required' => false)),
      'salary'                      => new sfValidatorNumber(),
      'payment_periodicity_id'      => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('PaymentPeriodicity'))),
      'payment_calculation_type_id' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('PaymentCalculationType'))),
      'location_id'                 => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('PositionLocation'), 'required' => false)),
      'shift_id'                    => new sfValidatorInteger(array('required' => false)),
      'wage_type_id'                => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('WageType'))),
      'created_at'                  => new sfValidatorDateTime(),
      'updated_at'                  => new sfValidatorDateTime(),
      'created_by'                  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('created_by_fk'))),
      'updated_by'                  => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('updated_by_fk'))),
    ));

    $this->widgetSchema->setNameFormat('position[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Position';
  }

}
